package servlet;

import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.db.conn;

public class dproducts_Edit extends HttpServlet {


	public dproducts_Edit() {
		super();
	}


	public void destroy() {
		super.destroy(); 
	}

	//编辑定制商品信息
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;");
		PrintWriter out = response.getWriter();

        //声明数据库操作类
		conn cn = new conn();

		//接收传递过来的值
        String id=request.getParameter("id");
        String tid=request.getParameter("se_tid");
        String ptitle=request.getParameter("txt_ptitle");
        String photo=request.getParameter("fujian");
        String price=request.getParameter("txt_price");
        String pememo=request.getParameter("txt_pememo");
        String pflag=request.getParameter("se_pflag");
		
		
        String sql="update dproducts set tid = "+tid+",ptitle = '"+ptitle+"',photo = '"+photo+"',price = "+price+",pememo = '"+pememo+"',pflag = '"+pflag+"' where pid='"+id+"'";

        
		
	
		//执行sql
		cn.update(sql);		

		out.println("<script>");
		out.println("alert('操作成功');");
		out.println("window.location='admin/dproducts/dproducts_Manage.jsp'");
		out.println("</script>");
	
		out.flush();
		out.close();
	}


	public void init() throws ServletException {
		// Put your code here
	}

}

